#!/usr/bin/python
# vi: et sw=2
#
# Test PulseObj
#
# Author: Harry Karvonen <harry.karvonen@gmail.com>
#

from GnomePulseAppletInterface import PulseObj,PulseSinkInputInfo,PulseVolume

pulse = PulseObj()

psifl = pulse.pulse_sink_input_list()

cl = dict(map(lambda x: (x.index, x), pulse.pulse_client_list()))

if psifl == None:
  psifl = []

# Set client
map(lambda x: x.setClient(cl[x.client_id]), psifl)

for c in cl:
  print cl[c]

for p in psifl:
  p.printDebug()
  #new_vol = PulseVolume(100)
  #pulse.pulse_set_sink_input_volume(p.index, new_vol)

#for p in psifl:
#  print p

# Mute and unmute streams
#for p in psifl:
#  if p.mute == 0:
#    print "Mute stream", p.client.name
#    pulse.pulse_mute_stream(p.index)
#  else:
#    print "Unmute stream", p.client.name
#    pulse.pulse_unmute_stream(p.index)
#
pulse.pulse_disconnect()

